package com.changgou.config;

import entity.ResBean;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 李民康
 * @date 2022/1/11 17:21
 */
@ControllerAdvice//前置处理
public class BaseExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public ResBean error(Exception e) {
        e.printStackTrace();
        return ResBean.error(e.getMessage());
    }
}
